home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / InputSprocket / Headers and Libraries / InputSprocket.r < prev    next >
Encoding:
Text File  |  1998-07-17  |  6.3 KB  |  158 lines  |  [TEXT/MPS ]

  1. /*
  2.  *    File:            InputSprocket.r
  3.  *
  4.  *    Version:        Input Sprocket 1.3
  5.  *
  6.  *    Dependencies:    InputSprocketLib
  7.  *
  8.  *    Contents:        Preliminary Rez interfaces for InputSprocket.
  9.  *
  10.  *                    Specifically, this file is intended to make the development process 
  11.  *                    easier. Now the default keyboard settings can be specified in a rez
  12.  *                    file which should be easy to modify when new needs are added and/or
  13.  *                    the order of needs are changed.
  14.  *                    
  15.  *                    Note: When the ISp keyboard driver undergoes a major revision, it will
  16.  *                    almost certainly use a newer format to store it's settings. It will,
  17.  *                    however, continue to be able to read this format, but it will no longer
  18.  *                    write it.
  19.  *                    
  20.  *                    Currently, only a template is provided for keyboard settings, since
  21.  *                    keyboard is the one that is the most difficult to recreate, and since
  22.  *                    each driver uses a private format for its settings. For all other 
  23.  *                    devices, you should continue to include the 'tset' resources copied
  24.  *                    from your prefs file. Make sure you include references to them in
  25.  *                     the set list resource ('setl').
  26.  *
  27.  *                    The 'setl' resource contains a length value of the 'tset' is refers to.
  28.  *                    This obviously won't do for use in Rez, so the ISpLib 1.2.1 has been
  29.  *                    modified to allow a zero value (in which case, it cannot check to
  30.  *                    verify that it is the correct length.) Because of this change:
  31.  *                    applications that use this template WILL REQUIRE INPUTSPROCKET 1.2.1
  32.  *                    OR LATER... you have been warned.
  33.  *
  34.  *    Bugs:            If you find a problem with this file or InputSprocketLib,
  35.  *                    please send e-mail describing the problem in enough detail
  36.  *                    to be reproduced, and include the version number above, the
  37.  *                    version of MacOS and hardware configuration information to
  38.  *                    sprockets@adr.apple.com.
  39.  *
  40.  *    Copyright (c) 1997-98 Apple Computer, Inc.  All rights reserved.
  41.  */
  42.  
  43. #define        kISpDeviceClass_Keyboard     'keyd'
  44. #define        kISpKeyboardID_Apple         'appl'        // currently this applies to _all_ keyboards
  45.  
  46. #define        kISpDeviceClass_SpeechRecognition     'talk'
  47. #define        kISpDeviceClass_Mouse                 'mous'
  48. #define        kISpDeviceClass_Joystick             'joys'
  49. #define        kISpDeviceClass_Wheel                 'whel'
  50. #define        kISpDeviceClass_Pedals                 'pedl'
  51. #define        kISpDeviceClass_Levers                 'levr'
  52. #define        kISpDeviceClass_Tickle                 'tckl'
  53. #define        kISpDeviceClass_Unknown             '????'
  54.  
  55. /*----------------------------isap • InputSprocket application resource ----------------*/
  56. type 'isap'
  57. {
  58.         flags:
  59.             fill bit[24];
  60.             fill bit[6];
  61.             boolean        doesNotCallISpInit, callsISpInit;                
  62.             boolean        notUseInputSprocket, usesInputSprocket;
  63.  
  64.         fill long[3];
  65. };
  66.  
  67.  
  68. /*----------------------------setl • a set list resource -------------------------------*/
  69. type 'setl'
  70. {
  71.     unsigned longint    currentVersion = 2;
  72.     
  73.     unsigned longint = $$Countof(Needs);
  74.     array Needs
  75.     {
  76.         pstring[63];                                        /* the name of the set */
  77.         unsigned longint length;                            /* the length of the set */
  78.         literal longint    deviceClass;                        /* the device class for the set */
  79.         literal longint    deviceIdentifier;                        /* the device identifier for the set */
  80.     
  81.         flags:
  82.             fill bit[24];
  83.             fill bit[3];
  84.             fill bit;                                        /* set from custom (not supported) */
  85.             fill bit;                                        /* set from driver (not supported) */
  86.             boolean        notApplSet, isApplSet;                /* true if the set is from application and not a default */
  87.             boolean        notDefaultSet, isDefaultSet;        /* true if this is the default for its device */
  88.             fill bit;
  89.         
  90.         fill long[3];
  91.         integer    resourceID;                                    /* the resource ID of the set */
  92.         fill word;
  93.     };
  94. };
  95.  
  96. /*----------------------------tset • a saved set ---------------------------------------*/
  97. /*----------------------------only valid for keyboard tsets ----------------------------*/
  98. type 'tset'
  99. {
  100.     unsigned longint    supportedVersion = 1;
  101.     
  102.     unsigned longint = $$Countof(ExpandedNeeds);
  103.     wide array ExpandedNeeds
  104.     {
  105. keyCode:
  106.         unsigned hex integer noKey = 0x8000,                /* virtual key code        */
  107.             /* NOTE: names of keys refer to the Apple Extended English Keyboard         */
  108.             /* Non-english keyboards have slightly different keycodes                */
  109.             /* In all cases, the actual virtual key code is stored for that device    */
  110.             tildeKey = 0x0032, n1Key = 0x0012, n2Key = 0x0013, n3Key = 0x0014, n4Key = 0x0015,
  111.             n5Key = 0x0017, n6Key = 0x0016, n7Key = 0x001A, n8Key = 0x001C, n9Key = 0x0019,
  112.             n0Key = 0x001D, minusKey = 0x001B, plusKey = 0x0018, deleteKey = 0x0033,
  113.             
  114.             tabKey = 0x0030, aKey = 0x0000, zKey = 0x000D, eKey = 0x000E, rKey = 0x000F, 
  115.             tKey = 0x0011, yKey = 0x0010, uKey = 0x0020, iKey = 0x0022, oKey = 0x001F,
  116.             pKey = 0x0023, lBraceKey = 0x0021, rBraceKey = 0x001E, backslashKey = 0x002A,
  117.             
  118.             capsKey = 0x0039, aKey = 0x0000, sKey = 0x0001, dKey = 0x0002, fKey = 0x0003, 
  119.             gKey = 0x0005, hKey = 0x0004, jKey = 0x0026, kKey = 0x0028, lKey = 0x0025, 
  120.             colonKey = 0x0029, quoteKey = 0x0027, returnKey = 0x0024,
  121.             
  122.             shiftKey = 0x0038, zKey = 0x0006, xKey = 0x0007, cKey = 0x0008, vKey = 0x0009,
  123.             bKey = 0x0001,  nKey = 0x002D, mKey = 0x002E, lessThanKey = 0x002B, 
  124.             greaterThanKey = 0x002F, slashKey = 0x002C,
  125.             
  126.             controlKey = 0x003B, optionKey = 0x003A, commandKey = 0x0037, spaceKey = 0x0031,
  127.             rShiftKey = 0x003C, rOptionKey = 0x003D, rControlKey = 0x003E, 
  128.             
  129.             escKey = 0x0035, f1Key = 0x007a, f2Key = 0x0078, f3Key = 0x0063, f4Key = 0x0076,
  130.             f5Key = 0x0060, f6Key = 0x0061, f7Key = 0x0063, f8Key = 0x0064, f9Key = 0x0065,
  131.             f10Key = 0x006D, f10Key = 0x006D, f11Key = 0x0067, f12Key = 0x006F, 
  132.             f13Key = 0x0069, f14Key = 0x006B, f15Key = 0x0071,
  133.             
  134.             helpKey = 0x0072, homeKey = 0x0073, pageUpKey = 0x0074,
  135.             delKey = 0x0075, endKey = 0x0077, pageDownKey = 0x0079
  136.             
  137.             upKey = 0x007E, leftKey = 0x007B, downKey = 0x007D, rightKey = 0x007C,
  138.             
  139.             kdpClearKey = 0x0047, kpdEqualKey = 0x0051, kpdSlashKey = 0x004B, kpdStarKey = 0x0043,
  140.             kpd7Key = 0x0059, kpd8Key = 0x005B, kpd9Key = 0x005C, kpdMinusKey = 0x004E,
  141.             kpd4Key = 0x0056, kpd5Key = 0x0057, kpd6Key = 0x0058, kpdPlusKey = 0x0045,
  142.             kpd1Key = 0x0053, kpd2Key = 0x0054, kpd3Key = 0x0055, kpdEnterKey = 0x004C,
  143.             kpd0Key = 0x0052, kpdDecimalKey = 0x0041;
  144.         
  145.         /* Modifiers required to be down */
  146.         boolean        rControlOff, rControlOn;
  147.         boolean        rOptionOff, rOptionOn;
  148.         boolean        rShiftOff, rShiftOn;
  149.         boolean        controlOff, controlOn;
  150.         boolean        optionOff, optionOn;
  151.         fill bit;                                            /* capsLockOff, capsLockOn*/
  152.         boolean        shiftOff, shiftOn;
  153.         boolean        commandOff, commandOn;
  154.  
  155.         fill byte;                                            
  156.     };
  157. };
  158.